<?php if(!defined('APP_ROOT')){exit('error!');}?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $site_title;?></title>
<link type="text/css" href="<?php echo PUBLIC_URL;?>css/font-awesome.min.css" rel="stylesheet">
<link type="text/css" href="<?php echo TEMPLATE_URL;?>style.css" rel="stylesheet">
<script type="text/javascript" src="<?php echo PUBLIC_URL;?>js/jquery.min.js"></script>
</head>
<body>
<div id="loginpage">
    <div id="loginbox">
        <form onsubmit="return doLogin()" method="post" name="loginForm">
            <h2>用户登录</h2>
            <div class="item">
                <input type="text" name="username" placeholder="输入账号名称" class="bar bar1">
            </div>
            <div class="item">
                <input type="password" name="password" placeholder="输入账号密码" class="bar bar1">
            </div>
            <div class="item">
                <input type="text" name="imgcode" placeholder="输入图片验证码" class="bar bar2">
                <img src="<?php echo APP_URL;?>include/lib/checkcode.php" alt="" id="imgcode">
            </div>
            <div class="item">
                <input type="text" name="safecode" placeholder="输入安全码" class="bar bar1">
            </div>
            <div class="item">
                <input type="hidden" name="action" value="login">
                <input type="submit" class="btn" value="立即登陆">
            </div>
        </form>
    </div>
</div>
<script type="text/javascript">
function doLogin(){
    var theData = $("form[name=loginForm]").serialize();
    $.ajax({
        'type':'post',
        'dataType':'json',
        'url':'<?php echo APP_URL;?>index/handle',
        'data':theData,
        'success':function(data){
            alert(data.msg);
            location.reload();
        }
    });
    return false;
}
</script>
</body>
</html>